<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./../../Template/generalTemplate.xhtml">

            <ui:define name="content">

                <h:form id="form">
                    <f:view beforePhase="#{editClientManagedBean.salesLeadInit}">
                        <p:panel id="editSalesLead" header="Edit Sales Lead" style="height:495px;">
                            <p:growl id="growl" showDetail="true" />
                            <div style="margin-top:45px;margin-left:330px;margin-right:50px;margin-bottom:20px;">
                                <h:panelGrid id="grid" columns="3">
                                    <h:outputText value="Company Name:" style="font-weight: bold;" />
                                    <p:inputText  id="companyName" required="true" requiredMessage="Company Name Can not be Blank" value="#{editClientManagedBean.salesLead.name}" />
                                    <p:message for="companyName" />
                                    
                                    <h:outputText value="Email:" style="font-weight: bold;" />
                                    <p:inputText  id="email" required="true" requiredMessage="Company email Can not be Blank" value="#{editClientManagedBean.salesLead.email}" />
                                    <p:message for="email" />
                                    
                                    <h:outputText value="Contact Person:" style="font-weight: bold;"/>
                                    <h:selectOneMenu id="title" required="true" requiredMessage="Please Select a Title" value="#{editClientManagedBean.salesLead.contactPersonTitle}">
                                        <f:selectItem itemLabel="Please select..." noSelectionOption="true"/>
                                        <f:selectItem itemValue="Mr" itemLabel="Mr"/>
                                        <f:selectItem itemValue="Mrs" itemLabel="Mrs"/>
                                        <f:selectItem itemValue="Ms" itemLabel="Ms"/>
                                    </h:selectOneMenu>
                                    <p:message  for="title" />


                                    <h:outputText value=""/>
                                    <p:inputText id="contactPerson" required="true" requiredMessage="Contact Person Name Can not be Blank" value="#{editClientManagedBean.salesLead.contactPersonName}"/>
                                    <p:message for="contactPerson"/>


                                    <h:outputText value="Contact Number:" style="font-weight: bold;"/>
                                    <p:inputMask id="contactNumber" required="true" requiredMessage="Contact Number Can not be Blank" value="#{editClientManagedBean.salesLead.contactNumber}" mask="(99)99999999"/>
                                    <p:message for="contactNumber"/>

                                    <h:outputText value="Company Type:" style="font-weight: bold;"/>
                                    <h:selectOneMenu id="type" required="true" requiredMessage="Please Select Company Type" value="#{editClientManagedBean.salesLead.companyType}">
                                       <f:selectItem itemLabel="Please select..." noSelectionOption="true"/>
                                       <f:selectItem itemValue="Direct Sales" itemLabel="Direct Sales"/>
                                       <f:selectItem itemValue="Whole Sales" itemLabel="Whole Sales"/>
                                    </h:selectOneMenu>
                                    <p:message for="type"/>

                                    <h:outputText value="Company Address:" style="font-weight: bold;"/>
                                    <p:inputText id="companyStreetName" required="true" requiredMessage="Company Address Street Name Can not be Blank" value="#{editClientManagedBean.salesLead.address.streetName}"/>
                                    <p:watermark value="street name" for="companyStreetName"/>
                                    <p:message for="companyStreetName"  />

                                    <p:inputText id="companyCity" required="true" requiredMessage="Company Address City Can not be Blank" value="#{editClientManagedBean.salesLead.address.city}"/>
                                    <p:watermark value="city name" for="companyCity"/>
                                    <p:message for="companyCity"  />

                                    <p:inputText id="companyPostCode" required="true" requiredMessage="Company Post Code Can not be Blank" value="#{editClientManagedBean.salesLead.address.postCode}"/>
                                    <p:watermark value="post code" for="companyPostCode"/>
                                    <p:message for="companyPostCode"  />
                                  </h:panelGrid>
                                
                                  <p:commandButton value="Save"  ajax="false" update="growl" actionListener="#{editClientManagedBean.salesLeadSaveChanges}" />
                                  <p:commandButton value="Back"  ajax="false" actionListener="#{editClientManagedBean.goBack}" />
                                  <p:commandButton value="Convert to Customer"  ajax="false" actionListener="#{editClientManagedBean.convert}" />
                                
                            </div>
                        </p:panel>
                    </f:view>
                </h:form>

            </ui:define>

        </ui:composition>

    </body>
</html>

